home *** CD-ROM | disk | FTP | other *** search
/ Delphi Programmer's Power Pack / Delphi Volume 1.iso / e_to_l / fbuilder / delphi / demos / ssheet.pas < prev    next >
Pascal/Delphi Source File  |  1996-09-15  |  1KB  |  67 lines

  1. { FormulaBuilder                }
  2. { YGB Software, Inc.            }
  3. { Copyright 1995 Clayton Collie }
  4. { All rights reserved           }
  5.  
  6. {* Unit which defines a dummy spreadsheet matrix object for use with *}
  7. {* the EIS demo series                                               *}
  8.  
  9. Unit ssheet;
  10. INTERFACE
  11. uses classes,sysutils;
  12.  
  13. CONST
  14.   MAXROWS = 10;
  15.   MAXCOLS = 10;
  16.  
  17. TYPE
  18.   PDouble = ^Double;
  19.   SheetMatrix = Array[1..MAXROWS,1..MAXCOLS] of double;
  20.  
  21.  
  22. TSpreadSheet = Class( TObject )
  23.   SheetData : SheetMatrix;
  24.   Constructor Create;
  25. end;
  26.  
  27.  
  28.   Function ParseCellName( name : string; var row , col : word ):boolean;
  29.  
  30. IMPLEMENTATION
  31.  
  32.   Function ParseCellName( name : string; var row , col : word ):boolean;
  33.   var i,p : byte;
  34.       rowstr, colstr : string[10];
  35.   begin
  36.     result := false;
  37.     name   := uppercase(name);
  38.     if name[1] <> 'R' then exit;
  39.     delete(name,1,1);
  40.     p := pos('C',name);
  41.     if p = 0 then exit;
  42.     rowstr := copy(name,1,p-1);
  43.     delete(name,1,p);
  44.     colstr := name;
  45.     try
  46.       row := strtoInt(rowstr);
  47.       col := strToInt(colstr);
  48.     except
  49.       exit;
  50.     end;
  51.     result := true;
  52.   end;
  53.  
  54.  
  55.  
  56.  
  57.  Constructor TSpreadSheet.Create;
  58.  var r,c : integer;
  59.  begin
  60.    inherited create;
  61.    for r := 1 to maxrows do
  62.    for c := 1 to maxcols do
  63.        SheetData[r,c] := random(45000) + 100 + random
  64.  end;
  65.  
  66. END.
  67.